﻿// ------------------------------------------------------------------------------
// Copyright  陶伟个人 版权所有。
// 项目名：Elasticsearch
// 文件名：ElasticsearchPage.cs
// 创建标识：陶伟 2018-01-10 15:02
// 创建描述：
//
// 修改标识：陶伟2018-01-10 15:07
// 修改描述：
//  ------------------------------------------------------------------------------

using Nest;
using ElasticsearchCore.Util.Common.Pages;

namespace ElasticsearchCore.ElasticSearch.Entity
{
    /// <summary>
    ///     ElasticsearchPage
    /// </summary>
    public class ElasticsearchPage<T> : PageEntity
    {
        public ElasticsearchPage()
        {

        }
        /// <summary>
        /// InitSearchRequest
        /// </summary>
        /// <returns></returns>
        public SearchRequest<T> InitSearchRequest(string index, string seachType)
        {
            return new SearchRequest<T>(index, seachType)
            {
                From = (PageIndex - 1) * PageSize,
                Size = PageSize
            };
        }
        public SearchRequest<T> InitSearchRequest(string index)
        {
            return new SearchRequest<T>(index)
            {
                From = (PageIndex - 1) * PageSize,
                Size = PageSize
            };
        }
    }
}